package com.zmn.plat.common.dictionary;

/**
 * 合同类型枚举
 *
 * @author linfeng
 * @since 2020/05/09 14:56:30
 */
public enum ContractTypeEnum {

    /**
     * values
     */
    PURCHASE(1, "采购合同"),
    MARKET(2, "营销合同"),
    LABOUR(3, "劳务合同"),
    EXTENSION(4, "推广合同"),
    COMMUNITY(5, "社区渠道合同"),
    BEIJING(6, "北京渠道合同"),
    OTHER(7, "其他合同"),
    MANAGEMENT(8, "综合管理文件")
    ;

    private Integer code;
    private String name;

    ContractTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ContractTypeEnum of(Integer code) {
        if (code == null || code == 0) {
            return PURCHASE;
        }
        switch (code) {
            case 1:
                return PURCHASE;
            case 2:
                return MARKET;
            case 3:
                return LABOUR;
            case 4:
                return EXTENSION;
            case 5:
                return COMMUNITY;
            case 6:
                return BEIJING;
            case 7:
                return OTHER;
            case 8:
                return MANAGEMENT;
            default:
                return PURCHASE;
        }
    }
}
